
public class P3 {
	public static boolean isPrime(long x) {
		long max = (long) Math.floor(Math.sqrt(x));
		for (long i = 2; i <= max; i++) {
			if (x%i == 0) {
				return false;
			}
		}
		
		return true;
	}
	
	
	public static void main(String[] args) {
		long x = 600851475143l;
		
		long max = (int) Math.floor(Math.sqrt(x));
		for (long i = 2; i < max; i++) {
			if (x%i == 0 && isPrime(i)) {
				System.out.println(i);
			}
		}
	}
}
